<?php 

class express  {



	public function add($parm){
		DB::insert("sysExpress",array('name','price'))->values(array($parm['name'],$parm['price']))->execute();
	}

	
	public function listdata($parm){
		$query = DB::query(Database::SELECT,
	         'select * from sysExpress   limit '.($parm['page']-1)*$parm['rows'].','.$parm['rows'])->execute()->as_array();
		$count = DB::query(Database::SELECT,
	         'select count(1) from sysExpress   ')->execute()->as_array();
		$data['total']=$count[0]['count(1)'];
		$data['rows']=$query;
		return $data;
	}

	public function getListExpress(){
		$result = DB::select('*')->from('sysexpress')->execute()->as_array();
		return $result;
	}
	public function detail($parm){
		$result = DB::select('*')->from('sysexpress')->where("id","=",$parm['id'])->execute()->as_array();
		return $result;
	}
	public function update($parm){

		DB::update("sysexpress")->set(array('name'=>$parm['name'],'price'=>$parm['price']))->where('id','=',$parm['id'])->execute();
	}
}